<template>
	<view style="height: 100vh; display: flex; flex-direction: column;">
		<lq-title title="详情"></lq-title>
		<scroll-view scroll-y style="flex: 1; padding: 0 30rpx;box-sizing: border-box;">
			<view class="top">
				<image :src="entity.pic"></image>
				<view class="top-content">
					<view class="title">{{entity.genius}}</view>
					<view class="sub-title">{{entity.sing}}</view>
				</view>
			</view>
			<view class="tag">
				<view class="tag-item">
					<view class="label">门票价格:</view>
					<view class="content">{{entity.price}}</view>
				</view>
				<view class="tag-item">
					<view class="label">擅长景点:</view>
					<view class="content">{{entity.area}}</view>
				</view>
				<view class="tag-item">
					<view class="label">可选位置:</view>
					<view class="content">{{entity.tag}}</view>
				</view>
			</view>

			<view class="banner">
				<view class="label">打卡景点</view>
				<swiper :indicator-dots="true" :autoplay="true" :circular="true">
					<swiper-item v-for="(item,index) in entity.tripPicUrls" @click="onPerviewImage(index)">
						<image :src="item"></image>
					</swiper-item>
				</swiper>
			</view>

		</scroll-view>

		<view class="bottom">
			<lq-button text='联系客服' @click.native="toChat"></lq-button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				entity: {},
			};
		},
		onLoad() {
			const eventChannel = this.getOpenerEventChannel();
			eventChannel.on('sendData', res => {
				this.entity = res;
				if (this.entity.trippic) {
					let trippic = this.entity.trippic;
					if (trippic.charAt(trippic.length - 1) === ',') {
						trippic = trippic.slice(0, -1);
					}
					this.entity.tripPicUrls = trippic.split(',');
				}
			})
		},
		methods: {
			toChat(item) {
				uni.showModal({
					title: '客服',
					content: `客服QQ：2778027813 工作时间9：00-18：00`
				})
			},
			onPerviewImage(index) {
				uni.previewImage({
					urls: this.entity.tripPicUrls,
					current: index,
				});
			}
		}
	}
</script>

<style lang="scss">
	.top {
		display: flex;
		flex-direction: row;
		height: 180rpx;
		margin-top: 30rpx;
		background-color: rgba(#000, 0.5);
		border-radius: 20rpx;

		image {
			width: 200rpx;
			height: 100%;
			border-radius: 20rpx;
		}

		.top-content {
			display: flex;
			flex-direction: column;
			justify-content: space-between;
			margin-left: 20rpx;
			padding: 20rpx 0;

			.title {
				font-size: 36rpx;
				color: #F2B77A;
				font-weight: bold;
			}

			.sub-title {
				font-size: 28rpx;
				color: #888;
			}
		}
	}

	.score-price {
		display: flex;
		flex-direction: row;
		margin-top: 30rpx;
		justify-content: center;

		.item {
			flex: 1;
			display: flex;
			flex-direction: column;
			justify-content: center;
			padding: 30rpx;
			margin: 0 15rpx;
			background-color: rgba(200, 205, 220, 0.5);
			border-radius: 20rpx;
			font-size: 24rpx;
			color: #555;
			text-align: center;

			.big {
				font-size: 36rpx;
				color: #222;
				font-weight: bold;
			}
		}
	}

	.tag {
		display: flex;
		flex-direction: column;
		margin: 30rpx 0;

		.tag-item {
			display: flex;
			flex-direction: row;
			margin: 10rpx 0;

			.label {
				font-size: 28rpx;
				color: #888;
			}

			.content {
				font-size: 28rpx;
				color: #eee;
				margin-left: 10rpx;
			}
		}
	}

	.banner {
		display: flex;
		flex-direction: column;

		.label {
			font-size: 36rpx;
			color: #888;
			font-weight: bold;
			margin-bottom: 10rpx;
		}

		swiper {
			height: 500rpx;

			swiper-item {
				height: 100%;

				image {
					width: 100%;
					height: 100%;
					border-radius: 30rpx;
				}
			}
		}
	}

	.bottom {
		margin: 30rpx;
	}
</style>